//
//  firstViewControllerTableViewCell.swift
//  AreaChainblock
//
//  Created by 赵佟越 on 2018/9/19.
//  Copyright © 2018年 zhaotongyue. All rights reserved.
//

import UIKit

class firstViewControllerTableViewCell: UITableViewCell
{
    var titleLab:UILabel?
    var mybackView:UIView?
    var coverImageView:UIImageView?
    var desLab:UILabel?
    var priceLab:UILabel?
    var LineView = UIView(frame: CGRect(x: 10, y: 89, width: kScreenWidth - 30, height: 1))
    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
        
        
    }
    
    override var frame:CGRect{
        didSet {
            var newFrame = frame
            newFrame.origin.x += 20/2
            newFrame.size.width -= 20
            newFrame.origin.y += 10
            newFrame.size.height -= 10
            super.frame = newFrame
        }
    }
    
    
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        
        self.lauoutUI()
    }
    
    func lauoutUI()  {
        self.backgroundColor = UIColor.clear
//        self.layer.cornerRadius = 4
//        self.layer.shadowOpacity = 0.3;
//        self.layer.shadowRadius = 2.0;
//        self.layer.shadowOffset = CGSize.init(width: 1, height: 1);
//        self.layer.shadowPath = UIBezierPath.init(roundedRect: self.bounds, cornerRadius: 5).cgPath
        self.clipsToBounds = true
        coverImageView = UIImageView()
        coverImageView?.backgroundColor = UIColor.clear
        self.contentView.addSubview(coverImageView!)
        coverImageView?.layer.cornerRadius = 22
        coverImageView?.snp.makeConstraints({ (make) in
            make.left.equalTo(self).offset(15)
            make.size.equalTo(CGSize(width: 44, height: 44))
            make.centerY.equalTo(self)
        })
        titleLab = UILabel()
        self.addSubview(titleLab!)
        titleLab?.textColor  = UIColor.white
        titleLab?.snp.makeConstraints({ (make) in
            make.left.equalTo((coverImageView?.snp.right)!).offset(10)
            make.centerY.equalTo(self)
            make.size.equalTo(CGSize(width: 200, height: 50))
        })
        
        titleLab?.font = UIFont.systemFont(ofSize: 16)
        priceLab = UILabel()
        priceLab?.textAlignment = .right
        priceLab?.textColor  = UIColor.white
        priceLab?.font = UIFont.systemFont(ofSize: 16)
        self.addSubview(priceLab!)
        priceLab?.snp.makeConstraints({ (make) in
            make.right.equalTo(self).offset(-35)
            make.centerY.equalTo(self)
            make.size.equalTo(CGSize(width: 200, height: 30))
        })
        
        
        LineView.backgroundColor = UIColor("#293163")
        
        self.addSubview(LineView)
        
    }

    override func awakeFromNib() {
        
        super.awakeFromNib()
        
        // Initialization code
        
    }
    
    
    override func setSelected(_ selected: Bool, animated: Bool) {
        
        super.setSelected(selected, animated: animated)
        // Configure the view for the selected state
        
    }
    
}
